package com.peanutplan.blog.model.vo;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;

import lombok.Data;

@Data
@Table(name="t_top_menu")
public class IndexMenu {
	
	public static String DEFAULT_MENU = "DEFAULT_MENU";
	
	/**
	 * 分类菜单，不可更改的
	 */
	public static String CATEGORY_MENU = "CATEGORY_MENU";
	
	/**
	 * 功能性菜单，不可更改的
	 */
	public static String OPTION_MENU = "OPTION_MENU";
	
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "JDBC")
    private Long id;

	@Column
    private String name;

	@Column
    private String url;
	
	@Column(name="index_")
    private Integer index;
	
	@Column(name="status_")
    private Integer status;
	
	@Column
    private String type;
	
	public Boolean getDefaultMenu() {
		if(StringUtils.isNotBlank(this.type)) {
			if(this.type.equals(CATEGORY_MENU) || this.type.equals(OPTION_MENU)) {
				return true;
			}
		}
		return false;
	}
}
